'''
Created on Jul 25, 2011

@author: mike
'''

from PyQt4 import QtGui, QtCore
import View.Widgets.EntityEditor.SliderWithLabels
import View.Widgets.EntityEditor.XYZ
from View.Widgets.EntityEditor.XYZ import XYZ


class Translate3D_ui(QtGui.QWidget):
    '''
    classdocs
    '''
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        #boxGridLayout = QtGui.QGridLayout(self)
        
        
        ##boxGridLayout.addWidget(workingbtn,0,0)
        

        
        
    def setupUi(self, Form):
        
        '''
        QtGui.QDoubleSpinBox()
        on
        QGroupBox 
        '''      
        self.Form = Form
        
        
        self.translate = XYZ("Translate", Form)
        
        
        self.translate.addField("X")

        self.translate.addField("Y")
        self.translate.addField("z")
    
        
        #workingbtn = QtGui.QPushButton("'Working' Auto Button")
        #workingbtn.setObjectName('workingbtn')
        #self.rotate.boxGridLayout.addWidget(workingbtn)
        #QtCore.QMetaObject.connectSlotsByName(self.rotate.boxGridLayout)
        '''
        rotate.x.valueChanged
        '''
        '''
        for spin  in self.rotate.spinArray:
            QtCore.QMetaObject.connectSlotsByName(spin)
            
            metaObject =spin.metaObject()
            print (metaObject.className())
            print(spin.objectName())
            QtCore.QMetaObject.connectSlotsByName(spin)
        '''
            #self.connect(QObject, SIGNAL())
            #methods = [metaObject.method(i).signature() for i in range(metaObject.methodOffset(), metaObject.methodCount())]
            #for method in methods:
            #   print (method)
        #QtCore.QMetaObject.connectSlotsByName(self.rotate.spinArray.index(1))
        #metaObject =self.metaObject()
        #methods = [metaObject.method(i).signature() for i in range(metaObject.methodOffset(), metaObject.methodCount())]
        #for method in methods:
        #    print (method)
    
    @QtCore.pyqtSlot()     
    def on_workingbtn_clicked(self):

        msg = 'This slot was automatically connected, and is called once'
        print(msg)
    
    @QtCore.pyqtSlot()
    def on_spin_valueChanged(self,):
        print ("x value changed")
        

class TranslateExample(QtGui.QWidget):
    '''
    Example / How-to
    '''
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Translate3D_ui()
        self.ui.setupUi(self)
        self.setMinimumSize(250,200 ) 
        #workingbtn = QtGui.QPushButton("'Working' Auto Button")
        #workingbtn.setObjectName('workingbtn')
        #boxGridLayout = QtGui.QGridLayout(self)
        #boxGridLayout.addWidget(workingbtn,0,0)
        
        
        
        
    @QtCore.pyqtSlot()
    def on_x_valueChanged(self):
        print ("x value changed")
        
    

    
   

    
from PyQt4.Qt import QApplication, QMainWindow

import sys
if __name__ == "__main__":
    
    app = QApplication(sys.argv)
    f = TranslateExample()

    m = QMainWindow()
    m.setCentralWidget(f)
    # Create a button which we will automatially connect to a slot, only
    # a bit more carefully :)
  
    #dock = QtGui.QDockWidget()
    #workingbtn = QtGui.QPushButton("'Working' Auto Button",dock)
    #workingbtn.setObjectName('workingbtn')
    #boxGridLayout = QtGui.QGridLayout(dock)
    #boxGridLayout.addWidget(workingbtn,0,0)
    
    
    #m.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
    #QtCore.QMetaObject.connectSlotsByName(m)
    m.show()
    app.exec()

        
        